<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    var userList = ["zhangsan","lisi","wangwu","zhaoliu"];
    //arr.shift();删除数组的第一个元素，数组的长的减1，
    //返回值为被删除的数组元素
    var result = userList.shift();
    console.log(result);
    console.log(userList);

    /*
    //全删
    while(userList.length>0){
        userList.shift();
    }
    console.log(result);
    console.log(userList);
    */

   //arr.pop();删除数组的最后一个元素，数组的长减1，
   //返回值为被删除的数组元素
    var result = userList.pop();
    console.log(result);
    console.log(userList);
</script>
</html>